(function($, F) {

	// Opening animation - fly from the top
	F.transitions.dropIn = function() {
		var endPos = F._getPosition(true);

		endPos.top = (parseInt(endPos.top, 10) - 200) + 'px';
		endPos.opacity = 0;

		F.wrap.css(endPos).show().animate({
			top : '+=200px',
			opacity : 1
		}, {
			duration : F.current.openSpeed,
			complete : F._afterZoomIn
		});
	};

	// Closing animation - fly to the top
	F.transitions.dropOut = function() {
		F.wrap.removeClass('fancybox-opened').animate({
			top : '-=200px',
			opacity : 0
		}, {
			duration : F.current.closeSpeed,
			complete : F._afterZoomOut
		});
	};

	// Next gallery item - fly from left side to the center
	F.transitions.slideIn = function() {
		var endPos = F._getPosition(true);

		endPos.left = (parseInt(endPos.left, 10) - 200) + 'px';
		endPos.opacity = 0;

		F.wrap.css(endPos).show().animate({
			left : '+=200px',
			opacity : 1
		}, {
			duration : F.current.nextSpeed,
			complete : F._afterZoomIn
		});
	};

	// Current gallery item - fly from center to the right
	F.transitions.slideOut = function() {
		F.wrap.removeClass('fancybox-opened').animate({
			left : '+=200px',
			opacity : 0
		}, {
			duration : F.current.prevSpeed,
			complete : function() {
				$(this).trigger('onReset').remove();
			}
		});
	};

	// Next gallery item - fly from left side to the center
	F.transitions.nextPage = function() {
	     alert(F.current.index+"_"+F.group.length);return;

		if (F.current.index >= F.group.length &&$("#pagenavi .current").next("a")) {
//			window.location.href = $("#pagenavi .current").next("a").attr(
//					"href");
		} else {
//			var wrap = F.wrap, current = F.current, effect = current.nextEffect, elastic = effect === 'elastic', startPos = F
//					._getPosition(elastic), endPos = {
//				opacity : 1
//			};
//
//			startPos.opacity = 0;
//
//			if (elastic) {
//				startPos.top = getValue(parseInt(startPos.top, 10) - 200);
//				endPos.top = '+=200px';
//			}
//
//			wrap.css(startPos).show().animate(endPos, {
//				duration : effect === 'none' ? 0 : current.nextSpeed,
//				easing : current.nextEasing,
//				complete : F._afterZoomIn
//			});
		}

	};

	// Next gallery item - fly from left side to the center
	F.transitions.prevPage = function() {
//	       alert(F.current.index+"_"+F.group.length);return;
		if (F.current.index <= 0&&$("#pagenavi .current").prev("a")) {
			window.location.href = $("#pagenavi .current").prev("a").attr(
					"href");
		} else {
			var wrap = F.wrap, current = F.current, effect = current.prevEffect, endPos = {
				opacity : 0
			}, cleanUp = function() {
				$(this).trigger('onReset').remove();
			};

			wrap.removeClass('fancybox-opened');

			if (effect === 'elastic') {
				endPos.top = '+=200px';
			}

			wrap.animate(endPos, {
				duration : effect === 'none' ? 0 : current.prevSpeed,
				easing : current.prevEasing,
				complete : cleanUp
			});
		}

	};

}(jQuery, jQuery.fancybox));